package com.ruoyi.site.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 购物车项目对象 cart_items
 *
 * @author chuckeytang
 * @date 2025-10-13
 */
public class CartItems extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 购物车项目ID */
    private Long cartItemId;

    /** 外键，关联 carts 表 */
    @Excel(name = "购物车ID")
    private Long cartId;

    /** 产品类型 ('track' 或 'sfx') */
    @Excel(name = "产品类型")
    private String productType;

    /** 音乐(track_id)或音效(sfx_id) ID */
    @Excel(name = "产品ID")
    private Long productId;

    /** 购买的授权类型/版本 (如果音乐有多个授权版本) */
    @Excel(name = "授权选项")
    private String licenseOption;

    /** 数量 */
    @Excel(name = "数量")
    private Integer quantity;

    /** 加入购物车时的价格 */
    @Excel(name = "价格")
    private BigDecimal priceAtAddition;

    /** 加入购物车时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addedAt;

    // --- 关联对象 (用于购物车详情展示) ---

    /** 关联的音乐曲目信息 */
    private Tracks track;

    /** 关联的音效信息 */
    private Sfx sfx;

    public Long getCartItemId() {
        return cartItemId;
    }

    public void setCartItemId(Long cartItemId) {
        this.cartItemId = cartItemId;
    }

    public Long getCartId() {
        return cartId;
    }

    public void setCartId(Long cartId) {
        this.cartId = cartId;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getLicenseOption() {
        return licenseOption;
    }

    public void setLicenseOption(String licenseOption) {
        this.licenseOption = licenseOption;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getPriceAtAddition() {
        return priceAtAddition;
    }

    public void setPriceAtAddition(BigDecimal priceAtAddition) {
        this.priceAtAddition = priceAtAddition;
    }

    public Date getAddedAt() {
        return addedAt;
    }

    public void setAddedAt(Date addedAt) {
        this.addedAt = addedAt;
    }

    public Tracks getTrack() {
        return track;
    }

    public void setTrack(Tracks track) {
        this.track = track;
    }

    public Sfx getSfx() {
        return sfx;
    }

    public void setSfx(Sfx sfx) {
        this.sfx = sfx;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("cartItemId", getCartItemId())
                .append("cartId", getCartId())
                .append("productType", getProductType())
                .append("productId", getProductId())
                .append("licenseOption", getLicenseOption())
                .append("quantity", getQuantity())
                .append("priceAtAddition", getPriceAtAddition())
                .append("addedAt", getAddedAt())
                .toString();
    }
}